/**
 *添加区域范围
 */
'use strict';

const conn = require('../../libs/DB/Conn');
const operationRecord = require("../sys/operationRecordAction");

module.exports = async function (params) {
    let insertObj ={
        range_name:params.rangeName,
        user_id:params.leaderId
    }
    if(params.lng && params.lat){
        insertObj.lng = params.lng;
        insertObj.lat = params.lat;
    }
    if(params.height){
        insertObj.height = params.height;
    }
    let updateSql = `UPDATE range_file SET ? WHERE range_id = ?`;
    await conn(updateSql, [insertObj,params.rangeId]);
    await operationRecord(params);
    return { success: true };
};
